package com.founder.bm.common
{
	import com.founder.framework.common.FounderUtils;
	import com.founder.framework.common.StringUtils;
	
	import flash.net.URLRequest;
	import flash.net.navigateToURL;
	
	import mx.collections.ArrayCollection;
	import mx.controls.Alert;
	import mx.core.FlexGlobals;
	import mx.utils.Base64Decoder;
	import mx.utils.StringUtil;
	import mx.utils.UIDUtil;

	public class CommonUtils
	{
		public static const BM:String="bm";
		
		public static var topLevelApplication:Object;

		public static function getServer(type:String):String
		{			
			return StringUtils.trim(topLevelApplication.server[type].url) + "/messagebroker/amf";
		}
		
		public static function getUID():String
		{
			return StringUtils.replaceAll(UIDUtil.createUID(), "-", "");
		}
		
		public static function getServerDowloadPath(type:String,filePath:String,fileName:String="excel.xls"):String{
			var uri:String=StringUtil.trim(topLevelApplication.server[type].url) + "/fileDownloadExcel?fileName=" + fileName + "&filePath=" + filePath;
			navigateToURL(new URLRequest(encodeURI(uri)), "_self");
			return uri;
		}
	}
}

